﻿#include "custom_data.h"
#include <iostream>
#include <sstream>
#include <thread>

using namespace boost::interprocess;

int main() {
    managed_shared_memory segment(open_or_create, "my_shared_memory", 524288000);
    custom_data data;
    data.init(segment);

    std::size_t index = 0;
    while (true) {
        // 生成随机数
        auto ret = data.pop_all();
        std::ostringstream oss;
        for (auto &&i : ret) {
            oss << i << ",";
        }
        std::cout << oss.str() << std::endl;
        std::this_thread::sleep_for(std::chrono::seconds(1));
    }

    return 0;
}